package net.oaktoncc;

import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * A device that captures energy use data.
 *
 * @author aeagle
 */
public abstract class SerialAuditDevice {

    /**
     * Set default serial
     * @param serialPort
     * @throws UnsupportedCommOperationException
     */
    public void setParams(final SerialPort serialPort) throws UnsupportedCommOperationException {
        serialPort.setSerialPortParams(19200,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
    }

    public abstract void downloadData(SerialPort port, final PrintWriter writer) throws IOException;
}
